package cn.qdhlm.collectservice.core.handler;

import cn.qdhlm.collectservice.common.util.ComUtil;
import cn.qdhlm.collectservice.core.component.Commander;
import cn.qdhlm.collectservice.model.dto.CommandParamDTO;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.collections.collection.CompositeCollection;
import org.apache.rocketmq.common.message.MessageExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Name:CommandHandler
 * @description:
 * @author: xinY
 **/
@Component
public class CommandHandler {
    @Autowired
    private Commander commander;
    public String process(MessageExt msg){
        CommandParamDTO commandParamDTO = JSONObject.parseObject(msg.getBody(), CommandParamDTO.class);
        return commander.execute(commandParamDTO.getAfn(),commandParamDTO.getFn(),commandParamDTO);
    }
}
